<template>
    <div class="mui-numbox" data-numbox-min='1' data-numbox-max='100'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="$store.getters.getNewCount" @change="changeNum" ref="numbox"/>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>
<script type="es6">
import mui from "../../lib/mui/js/mui.min.js";
export default {
    data(){
        return {
            count: 1
        }
    },
    methods: {
        changeNum() {
            var goodsnum = this.$refs.numbox.value;
            this.$store.commit('updateGoods',{id:1,count:goodsnum});
        }
    },
    mounted() {
    // 初始化数字选择框组件
        mui(".mui-numbox").numbox();
    }
}
</script>
<style lang="less" scoped>
    .mui-numbox {
        height: 30px;
        display: inline-block;
    }
</style>